package com.qimu.saiyou.model.vo;

import com.qimu.saiyou.model.entity.Compete;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Author: FeiXiang
 * @Date: 2024年02月26日 20:01
 * @Version: 1.0
 * @Description:
 */
@Data
public class CompeteVo implements Serializable {
    private static final long serialVersionUID = -376705222508889859L;
    private Long id;

    /**
     * 竞赛id
     */
    private Long competitionId;

    /**
     * 参加蓝方队伍id
     */
    private TeamVO blueTeam;

    /**
     * 参加红方队伍id
     */
    private TeamVO redTeam;
    private long redScore;
    private long blueScore;

    private List<CompeteUserVo> competeUserList;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 包装类转对象
     *
     * @param competeVO
     * @return
     */
    public static Compete voToObj(CompeteVo competeVO) {
        if (competeVO == null) {
            return null;
        }
        Compete compete = new Compete();
        BeanUtils.copyProperties(competeVO, compete);
        return compete;
    }

    /**
     * 对象转包装类
     *
     * @param compete
     * @return
     */
    public static CompeteVo objToVo(Compete compete) {
        if (compete == null) {
            return null;
        }
        CompeteVo competeVO = new CompeteVo();
        BeanUtils.copyProperties(compete, competeVO);
        return competeVO;
    }
}
